<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="font/iconfont.css">
    <link rel="stylesheet" href="css/login.css">
</head>

<body>
    <div class="login-box">
        <img src="./images/login/login-l.png" alt="" />
        <div class="login-form">
            <form class="el-form" id="formform">
                <div class="login-form-title">
                    <img src="./images/login/logo.png" alt="" style="width: 139px; height: 42px" />
                </div>
                <div class="el-form-item">
                    <!---->
                    <div class="el-form-item__content">
                        <div class="el-input el-input--prefix">
                            <!----><input type="text" name="username" autocomplete="off" placeholder="账号" maxlength="20"
                                class="el-input__inner" />
                            <span class="el-input__prefix"><i class="iconfont icon-account-outline"></i></span>
                            <!---->
                            <!---->
                            <!---->
                        </div>
                        <!---->
                    </div>
                </div>
                <div class="el-form-item">
                    <!---->
                    <div class="el-form-item__content">
                        <div class="el-input el-input--prefix">
                            <!----><input type="password" name="password" autocomplete="off" placeholder="密码"
                                maxlength="20" class="el-input__inner" /><span class="el-input__prefix"><i
                                    class="iconfont icon-lock-outline"></i></span>
                            <!---->
                            <!---->
                            <!---->
                        </div>
                        <!---->
                    </div>
                </div>
                <div class="el-form-item" style="width: 100%">
                    <!---->
                    <div class="el-form-item__content">
                        <button class="el-button login-btn el-button--primary el-button--medium" style="width: 100%">
                            <!---->
                            <!----><span><span>登录</span></span>
                        </button>
                        <!---->
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script src="/layui/layui.js"></script>
    <script src="./js/jquery.js"></script>
    <script src="./js/login.js"></script>
    <script>
        $('#formform').on('submit', function (e) {
            e.preventDefault()
            // console.log(1);
            $.ajax({
                method: 'post',
                url: 'http://121.4.102.44:8083/employee/login',
                data: JSON.stringify(
                    {
                        username: $('[type="text"]').val().trim(),
                        password: $('[type="password"]').val().trim(),
                    }
                ),
                contentType: "application/json",
                success(res) {
                    console.log(res);
                    if (res.code !== 1) {
                        return layui.layer.msg('登录失败', { icon: 5 })
                    }
                    layui.layer.msg('登陆成功', { icon: 6, time: 1000 }, function () {
                        location.href = '/index.html'
                    })

                }
            })
        })
    </script>


</body>

</html>